package com.cxc.java8;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class StreamFilter {

    public static void main(String[] args) {

        List<Integer> list = Arrays.asList(1,2,3,4,5,6,7,8,9,9,1,2,7);
        List<Integer> result = list.stream().filter(i -> i % 2 == 0).collect(Collectors.toList());
        System.out.println(result);

        result = list.stream().distinct().collect(Collectors.toList());
        System.out.println(result);

        result = list.stream().skip(5).collect(Collectors.toList());
        System.out.println(result);

        result = list.stream().limit(5).collect(Collectors.toList());
        System.out.println(result);

        list.forEach(System.out::println);

        list.forEach(i -> System.out.println(i));
        list.forEach((Integer i) -> System.out.println(i));

        for (int i : list) {
            System.out.println(i);
        }







    }

}
